Skip to content

Conversation

@mental-lab
Copy link

Context

Users were getting confused when their ANTHROPIC_API_KEY environment variable conflicted with their Claude Code subscription, causing authentication errors and unexpected behavior. Issue #2026 reported this as a common source of support requests where users didn't understand why their subscription wasn't working properly.

Implementation

Added a utility function [checkAnthropicApiKeyConflict()]

  1. Checks if ANTHROPIC_API_KEY environment variable exists
  2. Reads the user's configured API provider from VS Code settings
  3. Shows warning only when both conditions are true (env var exists + claude-code provider selected)
  4. Displays a helpful warning message with "More Info" button linking to the GitHub issue
  5. Called during extension activation to check on startup

Screenshots

before after
Users experienced silent authentication conflicts with no indication of the problem Users get clear warning message explaining the conflict and how to resolve it
image

How to Test

  1. Set up the conflict scenario:
    export ANTHROPIC_API_KEY="your-api-key"
    
  2. Configure VS Code settings:
  • Open Kilo Code settings
  • Set API provider to "Claude Code"
  1. Restart/reload the extension:
  • You should see a warning message: "An ANTHROPIC_API_KEY environment variable was detected..."
  • Click "More Info" to verify the GitHub issue link works
  • Click "Got it" to dismiss
  1. Test no false positives:
  • Change provider to different option → No warning should appear
  • Unset the environment variable → No warning should appear
  1. Run tests:
    pnpm test src/utils/__tests__/anthropicApiKeyWarning.spec.ts
    
    

Get in Touch

…vider

- Detects when ANTHROPIC_API_KEY env var is set with claude-code provider
- Shows user-friendly warning message with help link
- Includes test coverage
- Fixes Kilo-Org#2026
@changeset-bot
Copy link

changeset-bot bot commented Nov 4, 2025

⚠️ No Changeset found

Latest commit: acf4f95

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add warning when using Claude Code and ANTHROPIC_API_KEY is detected

1 participant